import request from '@/utils/request'
import {formDataFun} from './public'

// 表单
export function fromsave(data) {
  return request({
    url: '/ht-bpmn/from/save',
    method: 'post',
    data:data
  })
}
export function fromremove(id) {
  return request({
    url:`/ht-bpmn/from/remove/${id}`,
    method: 'delete'
  })
}
export function fromupdate(data) {
  return request({
    url: '/ht-bpmn/from/update',
    method: 'post',
    data:data
  })
}
export function frompage(data) {
  return request({
    url: '/ht-bpmn/from/page',
    method: 'post',
    data:data
  })
}
// export function frompage(data) {
//   return request({
//     url: '/ht-bpmn/from/page',
//     method: 'post',
//     data:data
//   })
// }

// 表头
export function basicadd(data) {
  return request({
    url: '/ht-bpmn/basic/add',
    method: 'post',
    data:data
  })
}
export function basicremove(id) {
  return request({
    url:`/ht-bpmn/basic/remove/${id}`,
    method: 'delete'
  })
}
export function basicupdate(data) {
  return request({
    url: '/ht-bpmn/basic/update',
    method: 'post',
    data:data
  })
}
export function basictreeList(data) {
  return request({
    url: '/ht-bpmn/basic/treeList',
    method: 'post',
    data:data
  })
}
export function basicLoadlibraryList(data) {
  return request({
    url: '/ht-bpmn/basicLoad/libraryList',
    method: 'post',
    data:data
  })
}
//------------
export function dicadd(data) {
  return request({
    url: '/ht-bpmn/dic/add',
    method: 'post',
    data:data
  })
}
export function dicremove(id) {
  return request({
    url:`/ht-bpmn/dic/remove/${id}`,
    method: 'delete',
  })
}
export function dicupdate(data) {
  return request({
    url: '/ht-bpmn/dic/update',
    method: 'post',
    data:data
  })
}
export function dicselectList(data) {
  return request({
    url: '/ht-bpmn/dic/selectList',
    method: 'get',
    data:data
  })
}
export function dictreeList(data) {
  return request({
    url: '/ht-bpmn/dic/treeList',
    method: 'get'
  })
}
export function dicdataTypeList(data) {
  return request({
    url: '/ht-bpmn/dic/dataTypeList',
    method: 'get'
  })
}
export function fromlist(data) {
  return request({
    url: '/ht-bpmn/from/list',
    method: 'get'
  })
}

export function activitideploy(formData,data) {
  return request({
    url: '/ht-bpmn/activiti/deploy?deployName='+data.deployName+"&externalParameterId="+data.externalParameterId,
    method: 'post',
    data:formData
  })
}

export function activitigetDeployList(data) {
  return request({
    url: '/ht-bpmn/activiti/getDeployList',
    method: 'post',
    data:data
  })
}

export function activitifindDeployFormById(data) {
  return request({
    url: '/ht-bpmn/activiti/findDeployFormById',
    method: 'post',
    data:data
  })
}

export function getColumPlace(place) {
  return request({
    url: `/ht-bpmn/basic/getColum/${place}`,
    method: 'get'
  })
}

export function activitidefinition(data) {
  return request({
    url: `/ht-bpmn/activiti/definition`,
    method: 'post',
    data:data
  })
}

export function activitifindToDoTask(data) {
  return request({
    url: `/ht-bpmn/activiti/findToDoTask`,
    method: 'post',
    data:data
  })
}

export function activititaskHistoryInfo(data) {
  return request({
    url: `/ht-bpmn/activiti/taskHistoryInfo`,
    method: 'post',
    data:data
  })
}

export function basicLoadpageListByBusinessKey(data) {
  return request({
    url: `/ht-bpmn/basicLoad/pageListByBusinessKey`,
    method: 'post',
    data:data
  })
}


export function activiticompleteTask(data) {
  return request({
    url: `/ht-bpmn/activiti/completeTask`,
    method: 'post',
    data:data
  })
}

export function activitifindOneselfApplication(data) {
  return request({
    url: `/ht-bpmn/activiti/findOneselfApplication`,
    method: 'post',
    data:data
  })
}
export function activitifindCompleteTask(data) {
  return request({
    url: `/ht-bpmn/activiti/findCompleteTask`,
    method: 'post',
    data:data
  })
}

export function activitiremoveFlowInstance(data) {
  return request({
    url: `/ht-bpmn/activiti/removeFlowInstance?processInstanceId=${data.processInstanceId}&reason=${data.reason}`,
    method: 'get'
  })
}

export function usergetUserList(data) {
  return request({
    url: `/ht-bpmn/user/getUserList`,
    method: 'post',
    data:data
  })
}
export function usergetRoleList(data) {
  return request({
    url: `/ht-bpmn/user/getRoleList`,
    method: 'post',
    data:data
  })
}

export function usersyncUsersInfo(data) {
  return request({
    url: `/ht-bpmn/user/syncUsersInfo`,
    method: 'post',
    data:data
  })
}
export function userfindUserRoleList(data) {
  return request({
    url: `/ht-bpmn/user/findUserRoleList?userId=`+data.userId,
    method: 'post'
    // data:data
  })
}
export function useraddUserRolesMapping(roleIds,userId) {
  return request({
    url: `/ht-bpmn/user/addUserRolesMapping?roleIds=${roleIds}&userId=${userId}`,
    method: 'post'
    // data:data
  })
}
export function userremoveRoleById(v) {
  return request({
    url: `/ht-bpmn/user/removeRoleById?roleId=${v}`,
    method: 'post'
  })
}

export function userupdateRoleName(v) {
  return request({
    url: `/ht-bpmn/user/updateRoleName`,
    method: 'post',
    data:v
  })
}

export function useraddRole(v) {
  return request({
    url: `/ht-bpmn/user/addRole`,
    method: 'post',
    data:v
  })
}
export function updateExternalParameter(data,v) {
  return request({
    url: `/ht-bpmn/from/updateExternalParameter?place=${v}`,
    method: 'post',
    data:{
      data:data
    }
  })
}

export function selectExternalParameter(v) {
  return request({
    url: `/ht-bpmn/from/selectExternalParameter?place=${v}`,
    method: 'post',
    data:{}
  })
}

export function getExternalParameterColum(v) {
  return request({
    url: `/ht-bpmn/basic/getExternalParameterColum?deployId=${v}`,
    method: 'get',
  })
}

export function createTask(places,deployId) {
  return request({
    url: `/ht-bpmn/basicLoad/createTask?places=${places}&deployId=${deployId}`,
    method: 'post',
    data:{}
  })
}
export function externalParamearamById(data) {
  return request({
    url: `/ht-bpmn/externalParameterEntity/selectColumAndParamById?id=${data}`,
    method: 'get'
  })
}

export function requestgetResByUrl(data) {
  return request({
    url: `/ht-bpmn/request/getResByUrl`,
    method: 'post',
    data
  })
}